package de.wbh.gwt.form.layouter.gwt.ui.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

import de.wbh.gwt.form.layouter.shared.activity.StartView;

public class StartViewImpl extends Composite implements StartView {

	interface StartViewImplUiBinder extends UiBinder<Widget, StartViewImpl> {
	}

	private static StartViewImplUiBinder uiBinder = GWT.create(StartViewImplUiBinder.class);
	private Presenter presenter;

	public StartViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiHandler("createButton")
	public void onCreateButtonClick(ClickEvent event) {
		if (this.presenter != null) {
			this.presenter.gotoCreate();
		}
	}

	@UiHandler("loadButton")
	public void onLoadButtonClick(ClickEvent event) {
		if (this.presenter != null) {
			this.presenter.gotoLoad();
		}
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}

}
